<template>
  <j-modal
    :title="'报表上报'"
    :width="800"
    :visible="visible"
    :maskClosable="false"
    :ok-button-props="{ props: { disabled: disableSubmit } }"
    :fullscreen="true"
    @close="close"
    cancelText="关闭"
  >
    <template slot="footer">
      <a-button key="back" style="padding-left: 8px; padding-right: 8px" @click="close(false)"> 关闭</a-button>
      <a-popconfirm :disabled="disableSubmit" title="确定保存吗?" @confirm="() => saveOrSubmit('save', null)">
        <a-button key="save" style="padding-left: 8px; padding-right: 8px" :disabled="disableSubmit"> 保存</a-button>
      </a-popconfirm>
      <a-button
        key="submit"
        type="primary"
        style="padding-left: 8px; padding-right: 8px"
        :disabled="disableSubmit"
        @click="close(true)"
      >
        提交审批
      </a-button>
    </template>
    <a-spin :spinning="Loading">
      <div :class="{ isCheck: isCheck }">
        <!-- <div class="table-header">
          <span class="table-title">填报单位：</span>{{model.departName}}
          <span class="table-title">审计负责人：</span>{{model.auditPersonName}}
          <span class="table-title">填表人：</span>{{model.createByText}}
          <span class="table-title">填表时间：</span>{{model.createTime}}
          <span class="table-title">统计时间：</span>{{model.year}}年（{{model.quarter}}季度）
        </div> -->
        <a-table
          class="edit-list"
          ref="table"
          size="middle"
          rowKey="id"
          bordered
          width="100vw"
          :pagination="false"
          :columns="columns"
          :dataSource="dataSource"
          :scroll="{ x: 250, y: 520 }"
        >
          <div slot="title">
            <div class="title">{{ title }}</div>
            <div class="sub-title">
              <div>填报单位：{{ model.departName }}</div>
              <div>{{ model.year }}年（{{ model.quarter }}季）度</div>
              <div>审计负责人：
                <fzrSelect :disabled="disableSubmit" v-model="model.head"></fzrSelect>
              </div>
              <div>填表人：{{ model.createByText }}</div>
              <div>填表时间：{{ model.createTime }}</div>
              <div>金额单位（万元）</div>
            </div>
          </div>

          <template slot="name" slot-scope="name">
            <!-- <j-ellipsis :value="name" :length="25"/> -->
            <div style="width: 100%; height: 45px; overflow-x: hidden; overflow-y: auto">{{ name }}</div>
          </template>
        </a-table>
        <div class="uploadFile" style="height: 40px; line-height: 40px; position: relative; margin-top: 10px;width:97vw">
          <span style="font-size: 16px" v-if="disableSubmit">说明性文件:</span>
          <ZUpload
            style="position: absolute; left: 120px;width:92%"
            :disabled="disableSubmit"
            :isShow="disableSubmit"
            ref="fileUpload"
            :fileid="model.fileId"
            @uploadFile="saveData"
            :isScroll="true"
          ></ZUpload>
        </div>
      </div>
    </a-spin>

    <SelectApprove ref="approver" @submitData="saveOrSubmit"></SelectApprove>
  </j-modal>
</template>
<script>
  import columns from './columns4'
  import SelectApprove from '../SelectApprover'
  import fzrSelect from '../fzrSelect'

  import ZUpload from '../../../components/ZUpload'
  import {deleteAction} from '@/api/manage'
  import {BbsbModelMixin2} from './BbsbModelMixin2'

  export default {
    name: 'ModelView4',
    mixins: [BbsbModelMixin2],
    components: {
      SelectApprove,
      ZUpload,
      fzrSelect
    },
    data() {
      return {
        columns: columns(this),
        model: {},
        btnStyle: 'save',
        approveId: '',
        sjType: '2',
        url: {
          list: '/sjxxzhbb/sjAuditInfo/getAuditInfoDetails',
          getCreatData: '/sjxxzhbb/sjAuditInfo//queryInformationOperation',
          add: '/sjxxzhbb/sjAuditInfo/add',
          edit: '/sjxxzhbb/sjAuditInfo/edit',
          delete: '/sjxxzhbb/sjAuditInfo/remove',
          submitData: '/common/sjProcCommon/auditShen',
        },
      }
    },
    created() {
    },
    methods: {
      // 保存或提交
      saveOrSubmit(style, approveId) {
        this.btnStyle = style
        this.approveId = approveId
        this.$refs.fileUpload.saveFile('zsjsynbsjjgjbqkb')
      },
      delete(record) {
        deleteAction(this.url.delete, {id: record.id}).then((res) => {
          if (res.success) {
            this.$message.success(res.message)
            this.$emit('ok')
          } else {
            this.$message.error(res.message)
          }
        })
      },
    },
  }
</script>

<style lang="less" scoped>
  // @import '../../../css/checkAndEdit.less';
  @import '../../css/baobiaotable.less';

  .table-header {
    margin-bottom: 10px;

    .table-title {
      font-weight: bold;
      margin-left: 15px;
    }
  }
</style>
